import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsBoolean, IsOptional, IsString } from 'class-validator';
import { PartialType } from '@nestjs/swagger';
import { Decorator_DtoIsNumber_Base } from '@/common/decorators/dtoIsNumber';

export class Platform_Create_Dto {
  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '商品名称' })
  platFormName: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '商品标签' })
  tags: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '商品logo' })
  productImgs: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '商品介绍' })
  introduce: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '商品详情' })
  goodDetail: string;

  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  @ApiProperty({ description: '销量' })
  hasSell: number;

  @IsBoolean()
  @IsNotEmpty()
  @ApiProperty({ default: false, description: '上下架状态' })
  status?: boolean;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '商品logo' })
  platFormLogo: string;

  @IsBoolean()
  @IsNotEmpty()
  @ApiProperty({ default: true, description: '是否推荐' })
  isRecommod?: boolean;

  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  @ApiProperty({ description: '商品分类ID' })
  platformsortId: number;
}

export class Platform_Find_Dto {
  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  size?: number;

  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  page?: number;

  @IsBoolean()
  @IsOptional()
  @ApiProperty({ description: '是否推荐' })
  isRecommod?: boolean;

  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  @ApiProperty({ description: '商品分类ID' })
  platformsortId?: number;

  @IsString()
  @IsOptional()
  @ApiProperty({ description: '商品名称' })
  platFormName?: string;
}

export class Platform_Update_Dto extends PartialType(Platform_Create_Dto) {
  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  id: number;
}
